
#include"UdpServer.hpp"
#include"Dictionary.hpp"
//./server_udp  localip localport
int main(int argc,char* argv[])
{
    if(argc != 2)
    {
       cerr << "Usage:"<<argv[0] << "localIp localPort" << endl;
       Die(USAGE_ERR);
    }
   // string ip = argv[1];
    uint16_t port = stoi(argv[1]);//转成整数

    ENABLE_CONSOLE_LOG(); //开启日志刷新到显示器
    shared_ptr<Dict> dict_sptr = make_shared<Dict>(); //构建字典对象
    std::unique_ptr<UdpServer> svr_uptr = make_unique<UdpServer>([&dict_sptr](const string& word){
         return dict_sptr->Translate(word);
    },port);
    svr_uptr->InitServer(); //初始化服务器
    svr_uptr->Start();
    return 0;
}